package cn.edu.scau.cmi.yanghaorui.hibernate.domain;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class Teacher implements java.io.Serializable {
 

  private Long id;
  private String name;
  private Set students = new HashSet<>(0);
  
  public Teacher() {
  }
  
public Teacher(Long id, String name, Set students) {
	//super();
	this.id = id;
	this.name = name;
	this.students = students;
}

/**
 * @return the id
 */
public Long getId() {
	return id;
}

/**
 * @param id the id to set
 */
public void setId(Long id) {
	this.id = id;
}

/**
 * @return the name
 */
public String getName() {
	return name;
}

/**
 * @param name the name to set
 */
public void setName(String name) {
	this.name = name;
}

/**
 * @return the students
 */
public Set getStudents() {
	return students;
}

/**
 * @param students the students to set
 */
public void setStudents(Set students) {
	this.students = students;
}
//@Override
public void show() {
	if(students.size()!=0) {
		System.out.print( "工号:"+this.id+"导师姓名:"+this.name+"导师所指导学生:");
		for(Iterator iterator=students.iterator();iterator.hasNext();) {
			Student ss=(Student)iterator.next();
			System.out.print(ss.getName());
		}
		System.out.println("");
	}
	else {
		System.out.println( "工号:"+this.id+"导师姓名:"+this.name);
	}
	
}



 /* public Long getId() {
    return this.id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getName() {
    return this.name;
  }

  public void setName(String name) {
    this.name = name;
  }*/

  /*public Set getStudents() {
    return this.students;
  }

  public void setStudents(Set students) {
    this.students = students;
  }*/
}
